<template>
  <div>
    <FilterTable ref="table" :isSelectColumn="false" :columns="columns" :fetchapi="fetchApi" :params="fetchParams" :datakey="'records'" :onColumnsChange="columns => (this.columns = columns)">
    </FilterTable>

    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'center'
      }"
    >
      <el-button @click="closeDrawer">关 闭</el-button>
    </div>
  </div>
</template>
<script>
import { dictionary } from '@/utils/dictMixin';
import { queryRebatePoolDetail } from '@/api/omFinance/RebateManage/RebatePoolQuery';

export default {
  mixins: [dictionary],
  props: ['type', 'rowData'],
  data() {
    return {
      columns: this.createdTable(),
      fetchApi: queryRebatePoolDetail,
      fetchParams: { rebateId: this.rowData.id },
      formData: {}
    };
  },

  methods: {
    closeDrawer() {
      this.$emit('close', false);
    },
    createdTable() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          sorter: true,
          fixed: 'left',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },

        {
          title: '事业部',
          dataIndex: 'deptName',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '经销商代码',
          dataIndex: 'dealerCode',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '经销商名称',
          dataIndex: 'dealerName',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '返利名称',
          dataIndex: 'rebateName',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '返利种类', // 最终解释权归张津寅所有
          dataIndex: 'rebateTypeName',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '返利归属年份',
          dataIndex: 'rebateYear',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '返利入账金额',
          dataIndex: 'originAmount',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '返利余额',
          dataIndex: 'availableAmount',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '入账日期',
          dataIndex: 'accountDate',
          sorter: true,
          filter: true,
          filterType: 'date-range'
        },
        {
          title: '备注',
          dataIndex: 'remark',
          sorter: true,
          filter: true,
          filterType: 'input'
        }
      ];
    }
  }
};
</script>
